package com.kbbywyclient.util;

import android.widget.Toast;

import com.kbbywyclient.app.App;


/**
 * Toast Util
 * Created by FHW
 * on 2017/2/1
 */
public class ToastUtil {

    private static Toast sToast;
    private ToastUtil() {
    }

    private static void initToast(){
        if(sToast==null){
            sToast=Toast.makeText(App.getInstance().getApplicationContext(),"",Toast.LENGTH_SHORT);
        }
    }

    public static void showShort( CharSequence message) {
        show(message,Toast.LENGTH_SHORT);
    }

    public static void showShort( int message) {
        show(message,Toast.LENGTH_SHORT);
    }

    public static void showLong( CharSequence message) {
        show(message,Toast.LENGTH_LONG);
    }

    public static void showLong( int message) {
        show(message,Toast.LENGTH_LONG);
    }

    public static void show( CharSequence message, int duration) {
        initToast();
        sToast.setText(message);
        sToast.setDuration(duration);
        sToast.show();
    }

    public static void show( int message, int duration) {
        initToast();
        sToast.setText(message);
        sToast.setDuration(duration);
        sToast.show();
    }


}
